<?

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#	FILE:			includes/custom/adminpagemove.php
#	FUNCTION:		Custom handler for the Admin Page Move page
#	AUTHOR:			Adrian
#	CREATED:		08/08/2005
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Parameters
#include



$selected_id = (@$_GET["page"]) ? $_GET["page"] : "";

# Get pages for pages moving function
$pagesMove = new Pages();

# SQL
$sqlMove = "SELECT p_id, p_name, p_parent, p_status, p_sort, p_section, p_accesstype, p_access, p_innavigation,p_content FROM " . $PROJECT_DB_TABLES["pages"] . " WHERE p_status < 3 AND p_status>0 AND  p_accessdatestart <= '" . getFullDate() . "' AND p_accessdateend >= '" . getFullDate() . "' ORDER BY p_sort ASC";

# Get record
$resultMove = getRecord($sqlMove, "p_id");

# Add pages
foreach ($resultMove as $key => $page_array) {
	$pagesMove -> addPage(new Page($key, $page_array));
}

$pagePath = $pagesMove -> getPathToPage($selected_id);

$curPage = $pagesMove -> getPage($selected_id); //Get current page

$curSection = $curPage -> getData("p_section");

$output = "<div class=\"MoveDivFrame\">";
	
$output .= "<table cellspacing=\"0\" align=\"left\">";

#the html code of sub directory
$SubDirContent = ""; 

$count = 0;

#If current page`s section is "site"
if($curSection == "site"){
	
	genertatePageMoveForm("","site");
	
	$tmp = $SubDirContent;

	#Site directory
	$output .= "<tr>";
	
	$output .= "<td class=\"movetd\" valign=\"top\"><img id=\"img_site\" src=\"../assets/images/tree/folder_open.png\" onclick=\"ExpandPage('site',false,true);\"/></td>";
	
	$output .= "<td class=\"movetd1\">site<br/><div id=\"divsite\">".$SubDirContent."</div></td>";
	
	$output .= "</tr>";
	
	#Admin directory
	$output .= "<tr>";
	
	$output .= "<td class=\"movetd\" valign=\"top\"><img id=\"img_admin\" src=\"../assets/images/tree/folder_closed.png\" onclick=\"ExpandPage('admin',true,true);\"/></td>";
	
	$output .= "<td class=\"movetd1\">admin<br/><div id=\"divadmin\"></div></td>";
	
	$output .= "</tr>";
}
else if($curSection == "admin"){
	
	genertatePageMoveForm("","admin");
	
	#Site directory
	$output .= "<tr>";
	
	$output .= "<td class=\"movetd\" valign=\"top\"><img id=\"img_site\" src=\"../assets/images/tree/folder_closed.png\" onclick=\"ExpandPage('site',true,true);\"/></td>";
	
	$output .= "<td style=\"border-color: white;border-style: solid;\">site<br/><div id=\"divsite\"></div></td>";
	
	$output .= "</tr>";
	
	#Admin directory
	$output .= "<tr>";
	
	$output .= "<td class=\"movetd\" valign=\"top\"><img id=\"img_admin\" src=\"../assets/images/tree/folder_open.png\" onclick=\"ExpandPage('admin',true,true);\"/></td>";
	
	$output .= "<td style=\"border-color: white;border-style: solid;\">admin<br/><div id=\"divadmin\">".$SubDirContent."</div></td>";
	
	$output .= "</tr>";
}

$output .= "</table>";
	
$output .= "</div>";
	
$output .= "<div>";
	
$output .= "<img id='img_up' style=\"display:none;\" src=\"../assets/images/tree/arrow_up.png\" onclick=\"MoveUpDown(true);\"/><img id='img_down' style=\"display:none;\" src=\"../assets/images/tree/arrow_down.png\" onclick=\"MoveUpDown(false);\"/>";	
				    
$output .= "SELECTED ITEM:<label id=\"lblSelected\"></label><label id=\"lblSelectedParent\"></label><label id=\"lblSelectedSection\"></label>";
	
$output .= "</div>";

addContent($output);

# Add the Flash
//addContent(generatePageMoveFlash($flash_filename, $flash_width, $flash_height));


//addContent(genertatePageMoveForm($selected_id));


?>